import Immutable from 'immutable';

const defaultState = new Immutable.List();

export default function suggestionReducer(state = defaultState, action) {
  switch(action.type) {

    case 'LOAD_SUGGESTION_DATA':
      if (action.data && action.data.success && action.data.data.length > 0) {
        return {
          data: action.data.data,
          count: action.data.count,
          offset: action.data.offset,
          limit: action.data.limit
        }
      }else {
        return {
          data: [],
          count: 0,
          offset: 0,
          limit:20
        }
      }
    default:
      return state;
  }
}
